package com.voc.im.controller.account;

import com.alibaba.fastjson.JSON;
import com.voc.im.bean.Account;
import com.voc.im.model.AccountModel;
import io.datafx.controller.FXMLController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;

import javax.annotation.PostConstruct;
import javax.inject.Inject;

@FXMLController("/fxml/account_vcard.fxml")
public class AccountVCardController {

    @FXML
    private TextField fieldNickname, fieldAutograph, fieldRegion, fieldSex;

    @Inject
    private AccountModel accountModel;

    @PostConstruct
    public void init() throws Exception {
        System.out.println(JSON.toJSONString(accountModel.getObjectProperty().get()));
        Account<Object> objectAccount = accountModel.getObjectProperty().get();
        Account.VCard vCard = (Account.VCard) objectAccount.getData();
        fieldNickname.setText(vCard.getNickname());
    }

    /**
     * 去注册点击事件
     */
    private void onAction(ActionEvent event) {
        accountModel.setActionProperty("register");
    }

    /**
     * 提交登录表单
     */
    private void onActionConfirmVCard(ActionEvent event) {
    }

}
